# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AndroidPublisher.V3.Model.BasePlan do
  @moduledoc """
  A single base plan for a subscription.

  ## Attributes

  *   `autoRenewingBasePlanType` (*type:* `GoogleApi.AndroidPublisher.V3.Model.AutoRenewingBasePlanType.t`, *default:* `nil`) - Set when the base plan automatically renews at a regular interval.
  *   `basePlanId` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. The unique identifier of this base plan. Must be unique within the subscription, and conform with RFC-1034. That is, this ID can only contain lower-case letters (a-z), numbers (0-9), and hyphens (-), and be at most 63 characters.
  *   `installmentsBasePlanType` (*type:* `GoogleApi.AndroidPublisher.V3.Model.InstallmentsBasePlanType.t`, *default:* `nil`) - Set for installments base plans where a user is committed to a specified number of payments.
  *   `offerTags` (*type:* `list(GoogleApi.AndroidPublisher.V3.Model.OfferTag.t)`, *default:* `nil`) - List of up to 20 custom tags specified for this base plan, and returned to the app through the billing library. Subscription offers for this base plan will also receive these offer tags in the billing library.
  *   `otherRegionsConfig` (*type:* `GoogleApi.AndroidPublisher.V3.Model.OtherRegionsBasePlanConfig.t`, *default:* `nil`) - Pricing information for any new locations Play may launch in the future. If omitted, the BasePlan will not be automatically available any new locations Play may launch in the future.
  *   `prepaidBasePlanType` (*type:* `GoogleApi.AndroidPublisher.V3.Model.PrepaidBasePlanType.t`, *default:* `nil`) - Set when the base plan does not automatically renew at the end of the billing period.
  *   `regionalConfigs` (*type:* `list(GoogleApi.AndroidPublisher.V3.Model.RegionalBasePlanConfig.t)`, *default:* `nil`) - Region-specific information for this base plan.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The state of the base plan, i.e. whether it's active. Draft and inactive base plans can be activated or deleted. Active base plans can be made inactive. Inactive base plans can be canceled. This field cannot be changed by updating the resource. Use the dedicated endpoints instead.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :autoRenewingBasePlanType =>
            GoogleApi.AndroidPublisher.V3.Model.AutoRenewingBasePlanType.t() | nil,
          :basePlanId => String.t() | nil,
          :installmentsBasePlanType =>
            GoogleApi.AndroidPublisher.V3.Model.InstallmentsBasePlanType.t() | nil,
          :offerTags => list(GoogleApi.AndroidPublisher.V3.Model.OfferTag.t()) | nil,
          :otherRegionsConfig =>
            GoogleApi.AndroidPublisher.V3.Model.OtherRegionsBasePlanConfig.t() | nil,
          :prepaidBasePlanType =>
            GoogleApi.AndroidPublisher.V3.Model.PrepaidBasePlanType.t() | nil,
          :regionalConfigs =>
            list(GoogleApi.AndroidPublisher.V3.Model.RegionalBasePlanConfig.t()) | nil,
          :state => String.t() | nil
        }

  field(:autoRenewingBasePlanType,
    as: GoogleApi.AndroidPublisher.V3.Model.AutoRenewingBasePlanType
  )

  field(:basePlanId)

  field(:installmentsBasePlanType,
    as: GoogleApi.AndroidPublisher.V3.Model.InstallmentsBasePlanType
  )

  field(:offerTags, as: GoogleApi.AndroidPublisher.V3.Model.OfferTag, type: :list)
  field(:otherRegionsConfig, as: GoogleApi.AndroidPublisher.V3.Model.OtherRegionsBasePlanConfig)
  field(:prepaidBasePlanType, as: GoogleApi.AndroidPublisher.V3.Model.PrepaidBasePlanType)

  field(:regionalConfigs,
    as: GoogleApi.AndroidPublisher.V3.Model.RegionalBasePlanConfig,
    type: :list
  )

  field(:state)
end

defimpl Poison.Decoder, for: GoogleApi.AndroidPublisher.V3.Model.BasePlan do
  def decode(value, options) do
    GoogleApi.AndroidPublisher.V3.Model.BasePlan.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AndroidPublisher.V3.Model.BasePlan do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
